package com.crane.common.framework.utils;


import com.crane.common.core.utils.StringUtil;
import org.springframework.util.StringUtils;

public class StringHideUtil {


    public static String hidePhone(String phone) {
        if (!StringUtils.hasText(phone)) {
            return "";
        }
        return StringUtil.mark(phone, '*', 3, 7);
    }

    public static String hideBankCardNo(String bankCardNo) {
        if (!StringUtils.hasText(bankCardNo)) {
            return "";
        }
        int length = bankCardNo.length();
        return StringUtil.mark(bankCardNo, '*', 6, length - 4);
    }

    public static String hideIdCardNo(String idCardNo) {
        if (!StringUtils.hasText(idCardNo)) {
            return "";
        }
        int length = idCardNo.length();
        return StringUtil.mark(idCardNo, '*', 3, length - 2);
    }


}
